/*
 * --------------------------------------------------------------
 * Copyright ©  2015 Hangzhou DtDream Technologies Co.,Ltd.
 * --------------------------------------------------------------
 *      Product: 协同数治
 *  Module Name: design
 * Date Created: 2023/3/6
 *  Description: TODO
 * --------------------------------------------------------------
 * Modification History
 * DATE            NAME            Description
 * --------------------------------------------------------------
 * 2023/3/6       yewj            TODO
 * --------------------------------------------------------------
 */

package com.dtdream.pattern.memento;

/**
 * TODO
 *
 * @Author: yewj
 **/
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        Caretaker caretaker = new Caretaker();

        originator.setState("状态1");
        caretaker.add(originator.saveStateMemento());

        originator.setState("状态2");
        caretaker.add(originator.saveStateMemento());

        originator.setState("状态3");
        caretaker.add(originator.saveStateMemento());

        System.out.println("当前状态" + originator.getState());

        System.out.println(caretaker.get(0));
    }
}
